package initialize

import (
	"fmt"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
	"kuangstudy-mall/apis/user-web/global"
	"kuangstudy-mall/apis/user-web/proto"
)

func InitClient() {

	conn, err := grpc.Dial(fmt.Sprintf("%s:%d", "127.0.0.1", 9000),
		grpc.WithTransportCredentials(insecure.NewCredentials()),
		grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy": "round_robin"}`),
	)
	if err != nil {
		panic(err)
	}
	global.UserClient = proto.NewUserClient(conn)
}
